<html>

<head>
	<script type="text/javascript" src="fsapi.js" onerror="alert('Error: failed to load ' + this.src)">
	</script>
	<script>
		// Set this to *false* to avoid addon auto-installation if missed.
		FireShotAPI.AutoInstall = true;

		function screenshotToBase64(mode) {
			FireShotAPI.base64EncodePage(mode, undefined, function (data) {
				var w = window.open('', 'View captured image', 'width=800,height=600,toolbar=1,scrollbars=1');
				w.document.write('<title>Preview base64 image</title>');
				w.document.write('<p><b>This is a captured image embedded into HTML by JavaScript.</b></p>');

				var img = w.document.createElement("IMG");
				img.style = "max-width:100%; height:auto";
				img.src = data;
				w.document.body.appendChild(img);
			});
		}
		
		function checkAvailability() {
			// We need to wait a little bit for the FS API initialization.
			setTimeout(function() {
				FireShotAPI.checkAvailability();
			}, 1000);
		}
		
		document.addEventListener("DOMContentLoaded", checkAvailability);
	</script>
</head>

<body>
	<div align="center">
		<form>
			<p>Capture entire webpage and:</p>
			<p><strong>Capture entire webpage and:</strong></p>
			<input type="button" onClick="FireShotAPI.editPage(true)" value="Edit">
			<input type="button" onClick="FireShotAPI.savePage(true)" value="Save">
			<input type="button" onClick="FireShotAPI.copyPage(true)" value="Copy">
			<input type="button" onClick="FireShotAPI.emailPage(true)" value="E-Mail">
			<input type="button" onClick="FireShotAPI.exportPage(true)" value="Export">
			<input type="button" onClick="FireShotAPI.uploadPage(true)" value="Upload">
			<input type="button" onClick="FireShotAPI.printPage(true)" value="Print">
			<input type="button" onClick="screenshotToBase64(true)" value="BASE64">
			<br><br>

			<p><strong>Capture visible part and:</strong></p>
			<input type="button" onClick="FireShotAPI.editPage(false)" value="Edit">
			<input type="button" onClick="FireShotAPI.savePage(false)" value="Save">
			<input type="button" onClick="FireShotAPI.copyPage(false)" value="Copy">
			<input type="button" onClick="FireShotAPI.emailPage(false)" value="E-Mail">
			<input type="button" onClick="FireShotAPI.exportPage(false)" value="Export">
			<input type="button" onClick="FireShotAPI.uploadPage(false)" value="Upload">
			<input type="button" onClick="FireShotAPI.printPage(false)" value="Print">
			<input type="button" onClick="screenshotToBase64(false)" value="BASE64">
		</form>
	</div>
</body>

</html>